Define metamodel¶
Overview¶
A metamodel defines the structure and relationships of an entity. By defining a metamodel, you can formalize what you should design and constraints that you should consider when designing.
In the following, we will focus on a use case model consisting of actors and use cases. This section describes the basic steps for creating a new profile and defining a metamodel.
Image of defining metamodel
About the overall structure of the metamodel
Since Next Design can handle various models related to the product in one project, the number of models in the project is large. Therefore, it is useful to have a hierarchical structure that allows you to roughly divide the model types directly under the project.
In the following, we will define the metamodel so that the project has the following hierarchical structure. In this project example, [Requirement model] and [Design model] are provided directly under the project, and the types of models are roughly classified.
It also increases the number of metamodel components defined in the profile. Therefore, it is easier to get a bird's-eye view of the entire metamodel by providing packages for each model type and classifying the components of the metamodel.
In the following, we will define the metamodel with the Use Case Model package as follows: In this profile example, the [Use Case Model] package is provided immediately below the root of the profile to classify the metamodel components.
Advance preparation¶
Understand the screen structure¶
When defining a metamodel, the profile navigator is displayed on the left, the class diagram is displayed in the center, and the inspector is displayed on the right.
To open the class diagram in the center, double-click the class diagram you want to open in the Profile Navigator. To close the class diagram, click the [x] icon that appears in the upper right corner of the class diagram.
Note
- Unlike the model editor, the class diagram display does not change even if the selected node is changed by clicking the tree node in the profile navigator.
- To view another class diagram, double-click the class diagram you want to view to open it.
Below, let's define the metamodel of the use case model by the following procedure.
- Add use case model to profile
- Define the structure of the use case model
1. Add use case model to profile¶
To add a use case model metamodel to your profile, follow these steps:
- Create a project for the new profile
- Configure profile and add [Use Case Model] entity
- Prepare class diagram to define [use case model] metamodel
1.1 Create a new project¶
Create project for new profile
To create a project for a new profile, follow the steps below to create a new project.
Operating procedure
- Launch Next Design and from the Start Menu, click the Start> Create New Project link.
- In the [Create New Project] dialog, enter the [Project Name], do not specify the [Profile], and click the [Create] button to create a new project.
Switch to screen configuration for metamodel definition
To switch to the screen configuration for metamodel definition explained in the preparation, follow the procedure below.
Operating procedure
- Select Profile Navigator from the selector at the top of the navigator to switch navigators.
- Click View> Pane> Inspector on the ribbon to display the Inspector on the right side of the screen.
1.2 Configure profile¶
Add entities directly under the project
In order to roughly divide the model types directly under the project, add the [Request model] entity in the following procedure.
Operating procedure
- Right-click [Project Definition Sample] displayed at the top of the profile navigator, and click From the context menu, click Add> Metamodel> Entity.
- In the [New Entity] dialog, enter the items as shown in the table below and click the [OK] button.
Item | Value |
---|---|
[Display Name] | Enter "Requirement Model" as the name |
[Class Name] | (The same name as the display name is automatically entered) |
[Icon] | Select an icon from the options |
Changed definition so that it can be placed directly under the project
The entities that can be added directly under the project in the model navigator during modeling are limited to specific entities. To be able to add the [Request Model] added in the previous step directly under the project, change the definition in the following step.
Operating procedure
- Select Requirement Model in the Profile Navigator to view the details in the Inspector.
- In the Inspector, check Allow deployment directly under the project.
Create a package and add [Use Case Model] entity
To put a package in your profile and add a Use Case Model entity, do the following:
Operating procedure
- Right-click [Project Definition Sample] displayed at the top of the profile navigator, and click From the context menu, click Add> Package.
- Right-click the added package and click Rename from the context menu to rename it to Use Case Model.
- Next, click Add> Metamodel> Entity from the package context menu.
- In the [New Entity] dialog, enter [Use Case Model] in [Display Name], select [Icon], and click the [OK] button.
1.3 Prepare a class diagram that defines the metamodel¶
Added class diagram to [Use Case Model]
To define the Use Case Model metamodel in UML class diagram format, add a class diagram as follows:
Operating procedure
- Right-click on the Use Case Model package on the Profile Navigator and click Click Add Class Diagram from the context menu.
- Enter Use Case Model Structural Diagram as the name of the class diagram added on the Profile Navigator.
Configure parent-child relationship of [use case model]
In order to create a model hierarchically at the time of modeling, it is necessary to connect the entities that correspond to the parent-child relationship in the ownership relationship.
To be able to add a Use Case Model under Requirement Model when modeling, follow these steps to establish an ownership relationship.
Operating procedure
- Double-click Use Case Model Structure Diagram to open the class diagram.
- Drag and drop the Request Model and Use Case Model from the Profile Navigator to add them to the class diagram.
- To make an association, move the pointer to the parent [Requirement Model], drag the [▲] icon displayed in the four directions, and drop it on the [Use Case Model] to be associated.
- When you drop it, the related type of choice pops up. Click [Embedded] from among them to select it.
- This establishes an ownership relationship from the Requirement Model to the Use Case Model and defines a parent-child relationship between the Requirement Model and the Use Case Model.
2. Define the structure of the use case model¶
To define the structure of the Use Case Model, add and associate the Actor and Use case entities to your class diagram. The procedure is as follows.
- Add [Actor] and [Use case] as entities.
- Add a field to the entity.
- Associate the entities to define the Use Case Model structure.
2.1 Add entity¶
To add an entity to your class diagram, do the following:
Operating procedure
- Add [Entity] from the Class Toolbox by dragging and dropping, and enter the name.
- Here, add [Actor] and [Use case] as entities.
Attention
- If you select an entity and press the Del key, it will only be hidden on the class diagram and will not be deleted from the metamodel, as on the context menu [Delete From Diagram]. Also remains.
- If you want to delete an entity that you added by mistake, execute [Delete From Model] from the context menu of the entity.
To change the icon of the added entity, do the following:
Operating procedure
- In the class diagram, select the entity whose icon you want to change.
- Select the icon in the Inspector.
2.2 Add fields to entities¶
To add a field to hold data for your entity:
Operating procedure
- Move the pointer over the entity in the class diagram.
- Click the [+] icon displayed at the right end of [Filelds]. Here, add the Precondition field (string type) to the Use case entity as follows:
- In the [Add New Fields] dialog, enter the items as shown in the table below and click the [OK] button.
Item | Value |
---|---|
[Display Name] | Enter "Precondition" as name |
[Field Name] | (The same name as the display name is automatically entered) |
[Data Type] | Select [String] from the options |
2.3 Associate to define structure¶
To be able to add another entity as a child element of an entity, you create an ownership relationship that represents a parent-child relationship between the entities.
Also, to allow association with entities other than parent-child relationships, such as [Actor] and [Use case], connect a reference relationship between the entities.
Here, the following two types of relationships are defined as the structure definition of [Use Case Model].
Relationship | Description |
---|---|
Ownership relationship from [UseCaseModel] to [Actor] and [UseCase]. | It becomes possible to add [Actor] and [Use case] as a child of [Use Case Model] from [Use Case Model] to [Actor] and [Use case]. |
Reference related to [Actor] to [Use case] | You can now associate [Actor] with [Use case]. |
Operating procedure
- Move the pointer over the source entity.
- Drag the [▲] icon that appears in four directions and drop it on the related entity.
- A related type of choice will pop up, click to select it.
Attention
- Similar to deleting an entity, if you select a related line on the class diagram and press the Del key, it will only be hidden on the class diagram, not deleted from the metamodel, but on the profile navigator. Also remains.
- If you want to delete an association that you added by mistake, select [Delete From Model] from the context menu of the association line.